package handlers

import (
	"fmt"
	"example.com/go-multi-demo/internal/models"
)

// ProductHandler 处理产品相关的HTTP请求
type ProductHandler struct{}

// GetProduct 模拟获取产品信息
func (h *ProductHandler) GetProduct(sku string) {
	product := models.Product{
		Name:  "示例产品",
		Price: 49.99,
		SKU:   sku,
	}
	fmt.Printf("获取产品 SKU %s: %s, 价格: %.2f\n", sku, product.Name, product.Price)
}

// CalculateDiscount 计算产品折扣
func (h *ProductHandler) CalculateDiscount(sku string, discount float64) {
	product := models.Product{
		Name:  "示例产品",
		Price: 100.0,
		SKU:   sku,
	}
	discountedPrice := product.CalculateDiscount(discount)
	fmt.Printf("产品 %s 的 %.1f%% 折扣后价格: %.2f\n", sku, discount, discountedPrice)
}